package com.heng.LockSupportDemo;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

//
public class LockSupportDemo5 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "\t---come in");
            LockSupport.park();
            System.out.println(Thread.currentThread().getName() + "\t---被唤醒");
        }, "t1");
        t1.start();

        try {TimeUnit.MILLISECONDS.sleep(10);}catch (InterruptedException e) {e.printStackTrace();}
        new Thread(() -> {
            LockSupport.unpark(t1);
            System.out.println(Thread.currentThread().getName()+"\t---发出通知");
        },"t2").start();
    }
}